class <%= class_name %>Asset < ActiveRecord::Base

  # TODO: decide if should tag wiki assets
  #acts_as_taggable_on :categories
  
  validates_presence_of     :user_id
  
  validates_each :file do |record, attr, value|
    record.errors.add :file, "name must be unique. There is already a file with this name." if (<%= class_name %>Asset.count(:conditions => ["file = ?", value.filename]) > 0)
  end  
  belongs_to :user
  
  upload_column :file,
                :store_dir => proc{|<%= file_name %>_asset| "<%= file_name %>_assets/#{<%= file_name %>_asset.id}/"},
                :tmp_dir => proc{|<%= file_name %>_asset| "file_assets/tmp/"}

end
